gdk/win32/gdkwindow-win32.c: Fix gdk_win32_window_set_icon_list()
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 24 Oct 2017 08:09:17 +0000 (16:09 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 24 Oct 2017 16:46:50 +0000 (00:46 +0800)
The list of surfaces passed into the function may be NULL, so don't try
to initialize the surfaces if it is so, to avoid a crash.

Also, remove the cast to GdkPixbuf* for getting surfaces->data, as we
are already using a cairo_surface_t*.

https://bugzilla.gnome.org/show_bug?id=773299

gdk/win32/gdkwindow-win32.c

index 65402bac45300770db56ccd8de8420ca27795400..07e5255395d4350cc8ab1689086d94476d80418d 100644 (file)
@@ -2328,7 +2328,7 @@ gdk_win32_window_set_icon_list (GdkWindow *window,
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_WINDOW_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window) || surfaces == NULL)
     return;
 
   impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
@@ -2344,9 +2344,10 @@ gdk_win32_window_set_icon_list (GdkWindow *window,
   small_surface = NULL;
   big_diff = 0;
   small_diff = 0;
+
   while (surfaces)
     {
-      surface = (GdkPixbuf*) surfaces->data;
+      surface = surfaces->data;
       w = cairo_image_surface_get_width (surface);
       h = cairo_image_surface_get_height (surface);